package main

import (
	"fmt"
)

type Person interface {
	GetJob() string
}

type Teacher struct {
	name string
}

func (t Teacher) GetJob() string {
	return t.name
}

type Student struct {
	name string
}

func (s Student) GetJob() string {
	return s.name
}

type BridgeObj struct {
	Character Person
}

func (b *BridgeObj) SetPerson(person Person) {
	b.Character = person
}

func (b BridgeObj) GetPerson() Person {
	return b.Character
}

func main() {
	bridgeObj := BridgeObj{}
	bridgeObj.SetPerson(Teacher{name:"王老师"})
	fmt.Println("本次桥接对象 " + bridgeObj.GetPerson().GetJob())

	bridgeObj.SetPerson(Student{name:"淘气包"})
	fmt.Println("本次桥接对象 " + bridgeObj.GetPerson().GetJob())
}
